/**
 * A ArrowTower figure. extends Tower.
 * @authors Itay Sorani, Nadav Ziv, Yonathan Zarsky
 */
package com.example.models.Towers;

import com.example.models.Tower;
import com.example.models.Unit;
import com.example.models.Units.DaVinciTank;
import com.example.models.Units.Goblin;
import com.example.models.Units.Phoneix;
import com.example.models.Units.Troll;

import android.content.Context;
import android.util.Log;



public class ArrowTower extends Tower {
	
	private static final int ARROW_TOWER_COST = 20;
	private static final int ARROW_TOWER_RANGE = 5;
	private static final int ARROW_TOWER_RATE = 1;
	private static final int ARROW_TOWER_DAMAGE_AGAINST_PHONEIX = 7;
	private static final int ARROW_TOWER_DAMAGE_AGAINST_DA_VINCI_TANK = 3;
	private static final int ARROW_TOWER_DAMAGE_AGAINST_GOBLIN = 5;
	private static final int ARROW_TOWER_DAMAGE_AGAINST_TROLL = 5;
	private static final String ARROW_TOWER_NAME = "ArrowTower";
	
	/**
     * Constructs a new ArrowTower according to range, fire rate, name and cost.
     */
	public ArrowTower(Context context) {
		super(context);
		setRange(ARROW_TOWER_RANGE);
		setRate(ARROW_TOWER_RATE * 40);
		setName(ARROW_TOWER_NAME);
		setCost(ARROW_TOWER_COST);
	}
	
	/**
     * returns the damage according to the given unit
     */
	public int getDamage(Unit unit) {
		if (unit instanceof Phoneix) {
			return (ARROW_TOWER_DAMAGE_AGAINST_PHONEIX);
		}
		if (unit instanceof DaVinciTank) {
			return (ARROW_TOWER_DAMAGE_AGAINST_DA_VINCI_TANK);
		}
		if (unit instanceof Goblin) {
			return (ARROW_TOWER_DAMAGE_AGAINST_GOBLIN);
		}
		if (unit instanceof Troll) {
			return (ARROW_TOWER_DAMAGE_AGAINST_TROLL);
		}
		return (0);
		
	}
}
